Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow inherited SQLStmts and Multiple inheritance #3813

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jankeirse
Copy link

  • Allow extending SQLStmt so that a method that expects a specific SQLStmt as input can force compile time validation to avoid the wrong SQLStmt being passed in.
  • Also check interfaces for SQLStmts, this allows using multiple inheritance through interfaces with default implementations to avoid one enormous superclass when many stored procedures share some logic but not all stored procedures share the same methods.

To use the multiple inheritance part you need to define the SLQStmts in the interface as statics, I haven't thoroughly tested yet if this has undesirable effects.

- Allow extending SQLStmt so that a method that expects a specific SQLStmt as input can force compile time validation to avoid the wrong SQLStmt being passed in. 
- Also check interfaces for SQLStmts, this allows using multiple inheritance through interfaces with default implementations to avoid one enormous superclass when many stored procedures share some logic but not all stored procedures share the same methods.
@jankeirse
Copy link
Author

You may probably also want to provide an interface IVoltProcedure to inherit the interfaces from to make the default implementations pretty. I have now put this in my own package that contains my stored procedures.

`public interface IVoltProcedure {

public void voltQueueSQL(SQLStmt stmt, Expectation expectation, Object[] args) ;

public void voltQueueSQL(SQLStmt stmt, Object... args) ;

public VoltTable[] voltExecuteSQL() ;

public VoltTable[] voltExecuteSQL(boolean isFinalSQL) ;

}`

@benjaminballard
Copy link
Contributor

Hi Jan,

Thanks for submitting this. It looks very good.

Please submit a signed Contributor Agreement (https://voltdb.com/contributor-license-agreement) to support@voltdb.com, before we can code review, test and merge this.

Thanks,
Ben

@besquared
Copy link

besquared commented Mar 30, 2018

+1 @jankeirse can you sign that so we can merge this? I think it could help organized trickier logic.

@jankeirse
Copy link
Author

@besquared I have signed and submitted the agreement in August 2016. We ended up using another solution instead of voltdb so I didn't follow up on this.

@benjaminballard
Copy link
Contributor

@jankeirse - I can confirm you did sign the CLA and it was fully executed. I'm not sure what happened, but this fell through the cracks. I'm creating a new ticket for someone in Engineering to review this. We will probably need to close this PR against master and move the commit to a branch for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants